<!--
 * @Author: zengwj
 * @Date: 2021-11-03 14:48:51
 * @LastEditors: zengwj
 * @LastEditTime: 2021-11-03 16:28:09
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var findSubsequences = function (nums) {
            let path = []
            let res = []
            function backtrack(start) {
                if (path.length >= 2) {
                    res.push([...path])
                }
                let arr = []
                for (let i = start; i < nums.length; i++) {
                    let num = nums[i]
                    if (path.length > 0 && path[path.length - 1] > num) {
                        continue
                    }
                    if (arr.includes(num)) {
                        continue
                    } else {
                        arr.push(num)
                    }
                    path.push(num)
                    backtrack(i + 1)
                    path.pop()
                }
            }
            backtrack(0)
            return res
        };
        console.log(findSubsequences([4, 4, 3, 2, 1]));
    </script>
</body>

</html>